<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use app\common\model\Operation as operationModel;
use think\facade\Cache;
use think\facade\View;

class Index extends AdminController {

    public function index(){

         if(!$this->admin_id){
             return redirect(url('user/login'))->send();
         }
        //获取菜单
        $operationModel = new operationModel();
        $menu = $operationModel->manageMenu($this->admin_id);
        View::assign('menu',$menu);
        $index_url = $menu[0]['code'].'/'.$menu[0]['children'][0]['code'];
        var_dump($index_url);
        View::assign('index_url',$index_url);
        return View::fetch();
    }


    public function clearCache(){
        Cache::clear(); //TODO 如果开启其他缓存，记得这里要配置缓存配置信息
        View::assign('msg','清除成功');
        View::assign('url','index/index');
        return View::fetch('common/tpl_success');
    }
}
